﻿using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;

namespace Apewer.Internals.Interop
{

    internal class Constant
    {

        /// <summary></summary>
        public const byte AC_SRC_OVER = 0;

        /// <summary></summary>
        public const byte AC_SRC_ALPHA = 1;

        /// <summary>从左到右显示。</summary>
        public const Int32 AW_HOR_POSITIVE = 0x00000001;

        /// <summary>从右到左显示。</summary>
        public const Int32 AW_HOR_NEGATIVE = 0x00000002;

        /// <summary>从上到下显示。</summary>
        public const Int32 AW_VER_POSITIVE = 0x00000004;

        /// <summary>从下到上显示。</summary>
        public const Int32 AW_VER_NEGATIVE = 0x00000008;

        /// <summary>若使用了AW_HIDE标志，则使窗口向内重叠，即收缩窗口；否则使窗口向外扩展，即展开窗口。</summary>
        public const Int32 AW_CENTER = 0x00000010;

        /// <summary>隐藏窗口，缺省则显示窗口。</summary>
        public const Int32 AW_HIDE = 0x00010000;

        /// <summary>激活窗口。在使用了AW_HIDE标志后不能使用这个标志。</summary>
        public const Int32 AW_ACTIVATE = 0x00020000;

        /// <summary>使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时，这个标志就被忽略。</summary>
        public const Int32 AW_SLIDE = 0x00040000;

        /// <summary>透明度从高到低。</summary>
        public const Int32 AW_BLEND = 0x00080000;

        /// <summary></summary>
        public const int CS_DROPSHADOW = 0x20000;

        /// <summary></summary>
        public const int FILE_ATTRIBUTE_NORMAL = 0x80;

        /// <summary></summary>
        public const uint FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000;

        /// <summary></summary>
        public const int FILE_MAP_COPY = 1;

        /// <summary></summary>
        public const int FILE_MAP_WRITE = 2;

        /// <summary></summary>
        public const int FILE_MAP_READ = 4;

        /// <summary></summary>
        public const int GCL_STYLE = (-26);

        /// <summary></summary>
        public const uint GENERIC_READ = 0x80000000;

        /// <summary></summary>
        public const uint GENERIC_WRITE = 0x40000000;

        /// <summary></summary>
        public const int GWL_EXSTYLE = -20;

        public const uint GGI_MARK_NONEXISTING_GLYPHS = 0x01;

        /// <summary></summary>
        public const int INVALID_HANDLE_VALUE = -1;

        /// <summary></summary>
        public const int OPEN_EXISTING = 3;

        /// <summary></summary>
        public const uint PAGE_READWRITE = 0x04;

        /// <summary></summary>
        public const int PROCESS_ALL_ACCESS = 0x1F0FFF;

        /// <summary></summary>
        public const int PROCESS_QUERY_INFORMATION = 0x400;

        public const int PROCESS_VM_READ = 0x0010;

        public const int PROCESS_VM_WRITE = 0x0020;

        /// <summary></summary>
        public const int SC_MOVE = 0xF010;

        /// <summary>play synchronously (default)</summary>
        public const int SND_SYNC = 0x0000;

        /// <summary>play asynchronously</summary>
        public const int SND_ASYNC = 0x0001;

        /// <summary>silence (!default) if sound not found</summary>
        public const int SND_NODEFAULT = 0x0002;

        /// <summary>pszSound points to a memory file</summary>
        public const int SND_MEMORY = 0x0004;

        /// <summary>loop the sound until next sndPlaySound</summary>
        public const int SND_LOOP = 0x0008;

        /// <summary>don’t stop any currently playing sound</summary>
        public const int SND_NOSTOP = 0x0010;

        /// <summary>Stop Playing Wave</summary>
        public const int SND_PURGE = 0x0040;

        /// <summary>don’t wait if the driver is busy</summary>
        public const int SND_NOWAIT = 0x00002000;

        /// <summary>name is a registry alias</summary>
        public const int SND_ALIAS = 0x00010000;

        /// <summary>alias is a predefined id</summary>
        public const int SND_ALIAS_ID = 0x00110000;

        /// <summary>name is file name</summary>
        public const int SND_FILENAME = 0x00020000;

        /// <summary>name is resource name or atom</summary>
        public const int SND_RESOURCE = 0x00040004;

        /// <summary></summary>
        public const int STILL_ALIVE = 0x103;

        /// <summary></summary>
        public const int SW_HIDE = 0;

        /// <summary></summary>
        public const int SW_SHOWNORMAL = 1;

        /// <summary></summary>
        public const int SW_SHOWMINIMIZED = 2;

        /// <summary></summary>
        public const int SW_SHOWMAXIMIZED = 3;

        /// <summary></summary>
        public const int SW_MAXIMIZE = 3;

        /// <summary></summary>
        public const int SW_SHOWNOACTIVATE = 4;

        /// <summary></summary>
        public const int SW_SHOW = 5;

        /// <summary></summary>
        public const int SW_MINIMIZE = 6;

        /// <summary></summary>
        public const int SW_SHOWMINNOACTIVE = 7;

        /// <summary></summary>
        public const int SW_SHOWNA = 8;

        /// <summary></summary>
        public const int SW_RESTORE = 9;

        /// <summary></summary>
        public const int ULW_ALPHA = 2;

        /// <summary></summary>
        public const int WM_CLOSE = 0x0010;

        /// <summary></summary>
        public const int WM_KEYDOWN = 0X100;

        /// <summary></summary>
        public const int WM_KEYUP = 0X101;

        /// <summary></summary>
        public const int WM_SYSCHAR = 0X106;

        /// <summary></summary>
        public const int WM_SYSKEYUP = 0X105;

        /// <summary></summary>
        public const int WM_SYSKEYDOWN = 0X104;

        /// <summary></summary>
        public const int WM_CHAR = 0X102;

        /// <summary></summary>
        public const int WS_EX_TRANSPARENT = 0x00000020;

        /// <summary></summary>
        public const int WS_EX_LAYERED = 0x00080000;

        /// <summary></summary>
        public const int WS_SYSMENU = 0x00080000;

        /// <summary></summary>
        public const int WS_MINIMIZEBOX = 0x00020000;

        public const int ENUM_CURRENT_SETTINGS = -1;
        public const int CDS_UPDATEREGISTRY = 0x01;
        public const int CDS_TEST = 0x02;

        public const int DISP_CHANGE_SUCCESSFUL = 0;
        public const int DISP_CHANGE_RESTART = 1;
        public const int DISP_CHANGE_FAILED = -1;
        public const int DISP_CHANGE_BADMODE = -2;
        public const int DISP_CHANGE_NOTUPDATED = -3;
        public const int DISP_CHANGE_BADFLAGS = -4;
        public const int DISP_CHANGE_BADPARAM = -5;
        public const int DISP_CHANGE_BADDUALVIEW = -6;

        public const int DMDO_DEFAULT = 0;
        public const int DMDO_90 = 1;
        public const int DMDO_180 = 2;
        public const int DMDO_270 = 3;

        #region 电源。

        public const int SE_PRIVILEGE_ENABLED = 0x00000002;
        public const int TOKEN_QUERY = 0x00000008;
        public const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
        public const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";

        public const int EWX_LOGOFF = 0x00000000;
        public const int EWX_SHUTDOWN = 0x00000001;
        public const int EWX_REBOOT = 0x00000002;
        public const int EWX_FORCE = 0x00000004;
        public const int EWX_POWEROFF = 0x00000008;
        public const int EWX_FORCEIFHUNG = 0x00000010;

        #endregion

        #region Windows Hook

        /// <summary>
        /// Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. 
        /// For more information, see the MessageProc hook procedure.
        /// </summary>
        public const int WH_MSGFILTER = -1;

        /// <summary>
        /// Installs a hook procedure that records input messages posted to the system message queue. 
        /// This hook is useful for recording macros. 
        /// For more information, see the JournalRecordProc hook procedure.
        /// </summary>
        public const int WH_JOURNALRECORD = 0;

        /// <summary>
        /// Installs a hook procedure that posts messages previously recorded by a WH_JOURNALRECORD hook procedure. 
        /// For more information, see the JournalPlaybackProc hook procedure.
        /// </summary>
        public const int WH_JOURNALPLAYBACK = 1;

        /// <summary>
        /// Installs a hook procedure that monitors keystroke messages. 
        /// For more information, see the KeyboardProc hook procedure.
        /// </summary>
        public const int WH_KEYBOARD = 2;

        /// <summary>
        /// Installs a hook procedure that monitors messages posted to a message queue. 
        /// For more information, see the GetMsgProc hook procedure.
        /// </summary>
        public const int WH_GETMESSAGE = 3;

        /// <summary>
        /// Installs a hook procedure that monitors messages before the system sends them to the destination window procedure. 
        /// For more information, see the CallWndProc hook procedure.
        /// </summary>
        public const int WH_CALLWNDPROC = 4;

        /// <summary>
        /// Installs a hook procedure that receives notifications useful to a CBT application. 
        /// For more information, see the CBTProc hook procedure.
        /// </summary>
        public const int WH_CBT = 5;

        /// <summary>
        /// Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. 
        /// The hook procedure monitors these messages for all applications in the same desktop as the calling thread. 
        /// For more information, see the SysMsgProc hook procedure.
        /// </summary>
        public const int WH_SYSMSGFILTER = 6;

        /// <summary>
        /// Installs a hook procedure that monitors mouse messages. 
        /// For more information, see the MouseProc hook procedure.
        /// </summary>
        public const int WH_MOUSE = 7;

        /// <summary>
        /// Installs a hook procedure useful for debugging other hook procedures. 
        /// For more information, see the DebugProc hook procedure.
        /// </summary>
        public const int WH_DEBUG = 9;

        /// <summary>
        /// Installs a hook procedure that receives notifications useful to shell applications.
        /// For more information, see the ShellProc hook procedure.
        /// </summary>
        public const int WH_SHELL = 10;

        /// <summary>
        /// Installs a hook procedure that will be called when the application's foreground thread is about to become idle. 
        /// This hook is useful for performing low priority tasks during idle time. 
        /// For more information, see the ForegroundIdleProc hook procedure.
        /// </summary>
        public const int WH_FOREGROUNDIDLE = 11;

        /// <summary>
        /// Installs a hook procedure that monitors messages after they have been processed by the destination window procedure. 
        /// For more information, see the CallWndRetProc hook procedure.
        /// </summary>
        public const int WH_CALLWNDPROCRET = 12;

        /// <summary>
        /// Installs a hook procedure that monitors low-level keyboard input events. 
        /// For more information, see the LowLevelKeyboardProc hook procedure.
        /// </summary>
        public const int WH_KEYBOARD_LL = 13;

        /// <summary
        /// >Installs a hook procedure that monitors low-level mouse input events. 
        /// For more information, see the LowLevelMouseProc hook procedure.
        /// </summary>
        public const int WH_MOUSE_LL = 14;

        #endregion

        #region vbKey 按键事件

        public const byte vbKeyLButton = 0x1;    // 鼠标左键
        public const byte vbKeyRButton = 0x2;    // 鼠标右键
        public const byte vbKeyCancel = 0x3;     // CANCEL 键
        public const byte vbKeyMButton = 0x4;    // 鼠标中键
        public const byte vbKeyBack = 0x8;       // BACKSPACE 键
        public const byte vbKeyTab = 0x9;        // TAB 键
        public const byte vbKeyClear = 0xC;      // CLEAR 键
        public const byte vbKeyReturn = 0xD;     // ENTER 键
        public const byte vbKeyShift = 0x10;     // SHIFT 键
        public const byte vbKeyControl = 0x11;   // CTRL 键
        public const byte vbKeyAlt = 18;         // Alt 键  (键码18)
        public const byte vbKeyMenu = 0x12;      // MENU 键
        public const byte vbKeyPause = 0x13;     // PAUSE 键
        public const byte vbKeyCapital = 0x14;   // CAPS LOCK 键
        public const byte vbKeyEscape = 0x1B;    // ESC 键
        public const byte vbKeySpace = 0x20;     // SPACEBAR 键
        public const byte vbKeyPageUp = 0x21;    // PAGE UP 键
        public const byte vbKeyEnd = 0x23;       // End 键
        public const byte vbKeyHome = 0x24;      // HOME 键
        public const byte vbKeyLeft = 0x25;      // LEFT ARROW 键
        public const byte vbKeyUp = 0x26;        // UP ARROW 键
        public const byte vbKeyRight = 0x27;     // RIGHT ARROW 键
        public const byte vbKeyDown = 0x28;      // DOWN ARROW 键
        public const byte vbKeySelect = 0x29;    // Select 键
        public const byte vbKeyPrint = 0x2A;     // PRINT SCREEN 键
        public const byte vbKeyExecute = 0x2B;   // EXECUTE 键
        public const byte vbKeySnapshot = 0x2C;  // SNAPSHOT 键
        public const byte vbKeyDelete = 0x2E;    // Delete 键
        public const byte vbKeyHelp = 0x2F;      // HELP 键
        public const byte vbKeyNumlock = 0x90;   // NUM LOCK 键

        public const byte vbKeyA = 65;
        public const byte vbKeyB = 66;
        public const byte vbKeyC = 67;
        public const byte vbKeyD = 68;
        public const byte vbKeyE = 69;
        public const byte vbKeyF = 70;
        public const byte vbKeyG = 71;
        public const byte vbKeyH = 72;
        public const byte vbKeyI = 73;
        public const byte vbKeyJ = 74;
        public const byte vbKeyK = 75;
        public const byte vbKeyL = 76;
        public const byte vbKeyM = 77;
        public const byte vbKeyN = 78;
        public const byte vbKeyO = 79;
        public const byte vbKeyP = 80;
        public const byte vbKeyQ = 81;
        public const byte vbKeyR = 82;
        public const byte vbKeyS = 83;
        public const byte vbKeyT = 84;
        public const byte vbKeyU = 85;
        public const byte vbKeyV = 86;
        public const byte vbKeyW = 87;
        public const byte vbKeyX = 88;
        public const byte vbKeyY = 89;
        public const byte vbKeyZ = 90;

        public const byte vbKey0 = 48;
        public const byte vbKey1 = 49;
        public const byte vbKey2 = 50;
        public const byte vbKey3 = 51;
        public const byte vbKey4 = 52;
        public const byte vbKey5 = 53;
        public const byte vbKey6 = 54;
        public const byte vbKey7 = 55;
        public const byte vbKey8 = 56;
        public const byte vbKey9 = 57;

        public const byte vbKeyNumpad0 = 0x60;
        public const byte vbKeyNumpad1 = 0x61;
        public const byte vbKeyNumpad2 = 0x62;
        public const byte vbKeyNumpad3 = 0x63;
        public const byte vbKeyNumpad4 = 0x64;
        public const byte vbKeyNumpad5 = 0x65;
        public const byte vbKeyNumpad6 = 0x66;
        public const byte vbKeyNumpad7 = 0x67;
        public const byte vbKeyNumpad8 = 0x68;
        public const byte vbKeyNumpad9 = 0x69;
        public const byte vbKeyMultiply = 0x6A;   // MULTIPLICATIONSIGN (*)
        public const byte vbKeyAdd = 0x6B;        // PLUS SIGN (+)
        public const byte vbKeySeparator = 0x6C;  // ENTER
        public const byte vbKeySubtract = 0x6D;   // MINUS SIGN (-)
        public const byte vbKeyDecimal = 0x6E;    // DECIMAL POINT (.)
        public const byte vbKeyDivide = 0x6F;     // DIVISION SIGN (/)

        public const byte vbKeyF1 = 0x70;
        public const byte vbKeyF2 = 0x71;
        public const byte vbKeyF3 = 0x72;
        public const byte vbKeyF4 = 0x73;
        public const byte vbKeyF5 = 0x74;
        public const byte vbKeyF6 = 0x75;
        public const byte vbKeyF7 = 0x76;
        public const byte vbKeyF8 = 0x77;
        public const byte vbKeyF9 = 0x78;
        public const byte vbKeyF10 = 0x79;
        public const byte vbKeyF11 = 0x7A;
        public const byte vbKeyF12 = 0x7B;

        #endregion

    }

}
